package com.sinosoft.shopcar;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.shiro.SecurityUtils;

import com.sinosoft.base.Constants;
import com.sinosoft.orderinfomodel.OrderInfoModel;
import com.sinosoft.orderinfomodel.OrderInfoModelManager;
import com.sinosoft.product.ZywxImage0;
import com.sinosoft.product.ZywxImage0Product;
import com.sinosoft.product.ZywxImage1;
import com.sinosoft.product.ZywxImage1a;
import com.sinosoft.product.ZywxImage1b;
import com.sinosoft.product.ZywxImage1c;
import com.sinosoft.product.ZywxImage2;
import com.sinosoft.product.ZywxImage2a;
import com.sinosoft.product.ZywxImage2b;
import com.sinosoft.product.ZywxImage2c;
import com.sinosoft.product.ZywxImage3;
import com.sinosoft.product.ZywxImage4;
import com.sinosoft.product.ZywxImage5;
import com.sinosoft.product.ZywxImageHighDem;
import com.sinosoft.product.ZywxImageHighDom;
import com.sinosoft.product.ZywxImageHighEpistereo;
import com.sinosoft.product.ZywxImageHighRect;
import com.sinosoft.product.ZywxImageHighSdem;
import com.sinosoft.product.ZywxImageHighSdom;

public class SwitchToShopcar {
	public static String username = null;

	/**
	 * 1-4级产品加入购物车
	 * 
	 * @param objlist
	 * @param omodelmgr
	 * @param isProduceOrder
	 * @return
	 */
	public static List<Shopinfo> getShopinfo(List<Object> objlist,
			OrderInfoModelManager omodelmgr, String isProduceOrder) {
		username = SecurityUtils.getSubject().getPrincipal().toString();
		final int userdefault = 1;
		OrderInfoModel orderinfomodel = omodelmgr
				.getOrderInfoModelByDefaultAndUsername(username, userdefault);
		List<Shopinfo> shopinfolist = new ArrayList<Shopinfo>();
		for (Object o : objlist) {
			Shopinfo s = new Shopinfo();
			if (o instanceof ZywxImage0)// 0级产品
			{
				ZywxImage0 z = (ZywxImage0) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL0_SCENE, z.getSatelliteid(), z
									.getSensorid());
				if (isProduceOrder != null
						&& isProduceOrder.equalsIgnoreCase("YES")) {
					s = changeShopInfoOfProduce(orderinfomodel);
					s.setTasktype(new BigDecimal(1));
				} else {
					s = changeShopInfoOfproduct(orderinfomodel);
					s.setTasktype(new BigDecimal(2));
					s.setProductlevel(Constants.LEVEL0_SCENE);
				}
				if (z.getDatasetid() != null) {
					s.setStripid(z.getDatasetid().toString());
				}
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setSceneid(z.getScenenum());
				s.setBandnumber(z.getBand());
				s.setScenecount(z.getScenedatacount());
				s.setReceivestationid(z.getReceivestationid());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
			
			}

			// 普通订单，应用元数据自带数据
			if (o instanceof ZywxImage5)// 5级产品
			{
				ZywxImage5 z = (ZywxImage5) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_5, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_5);
				s.setProducttype(z.getProducttype());
				// s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setReceivestationid(z.getReceivestationid());
				s.setEarthmodel(z.getEarthmodel());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				// s.setScenecount(z.getScenecount());
				// s.setSceneshift(z.getSceneshift());
				// s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				 
				// s.setStripid(z.getStripid());
				s.setEarthmodel(z.getEarthmodel());// 地球模型
				s.setProductuploaddir(z.getDataarchivefile());
			} else if (o instanceof ZywxImage0Product)// 0级产品
			{
				ZywxImage0Product z = (ZywxImage0Product) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_0_PRODUCT, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_0_PRODUCT);
				s.setProducttype(z.getProducttype());
				s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setReceivestationid(z.getReceivestationid());
				s.setEarthmodel(z.getEarthmodel());
				s.setPgproductformat(z.getProductformat());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setEarthellipsoid(z.getEarthellipsoid());
				s.setResamplingkernel(z.getResamplingkernel());
				s.setHeightmode(z.getHeightmode());
				s.setEphemerisdata(z.getEphemerisdata());
				s.setAttitudedata(z.getAttitudedata());
				s.setRadiometricmethod(z.getRadiometricmethod());
				if (z.getMtfcorrection() != null
						&& !"".equals(z.getMtfcorrection()))// 是否做MTF
					s.setMtfcpromode(z.getMtfcorrection());
				if (z.getDenoise() != null && !"".equals(z.getDenoise()))// 是否去噪
					s.setDenoise(z.getDenoise());
				if (z.getRayleighcorrection() != null
						&& !"".equals(z.getRayleighcorrection()))// 是否做瑞利散射校正
					s.setRayleighcorrection(z.getRayleighcorrection());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				s.setScenecount(z.getScenecount());
				s.setSceneshift(z.getSceneshift());
				s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				s.setStripid(z.getStripid());
				s.setEarthmodel(z.getEarthmodel());// 地球模型
				s.setProductuploaddir(z.getDataarchivefile());
			} else if (o instanceof ZywxImage1)// 1级产品
			{
				ZywxImage1 z = (ZywxImage1) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_1, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_1);
				s.setProducttype(z.getProducttype());
				s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setReceivestationid(z.getReceivestationid());
				s.setEarthmodel(z.getEarthmodel());
				s.setPgproductformat(z.getProductformat());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setEarthellipsoid(z.getEarthellipsoid());
				s.setResamplingkernel(z.getResamplingkernel());
				s.setHeightmode(z.getHeightmode());
				s.setEphemerisdata(z.getEphemerisdata());
				s.setAttitudedata(z.getAttitudedata());
				s.setRadiometricmethod(z.getRadiometricmethod());
				if (z.getMtfcorrection() != null
						&& !"".equals(z.getMtfcorrection()))// 是否做MTF
					s.setMtfcpromode(z.getMtfcorrection());
				if (z.getDenoise() != null && !"".equals(z.getDenoise()))// 是否去噪
					s.setDenoise(z.getDenoise());
				if (z.getRayleighcorrection() != null
						&& !"".equals(z.getRayleighcorrection()))// 是否做瑞利散射校正
					s.setRayleighcorrection(z.getRayleighcorrection());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				s.setScenecount(z.getScenecount());
				s.setSceneshift(z.getSceneshift());
				s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				s.setStripid(z.getStripid());
				s.setEarthmodel(z.getEarthmodel());// 地球模型
				s.setProductuploaddir(z.getDataarchivefile());
			} else if (o instanceof ZywxImage2)// 2级产品
			{
				ZywxImage2 z = (ZywxImage2) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_2, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_2);
				s.setProducttype(z.getProducttype());
				s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setReceivestationid(z.getReceivestationid());
				s.setEarthmodel(z.getEarthmodel());
				s.setPgproductformat(z.getProductformat());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setEarthellipsoid(z.getEarthellipsoid());
				s.setResamplingkernel(z.getResamplingkernel());
				s.setHeightmode(z.getHeightmode());
				s.setEphemerisdata(z.getEphemerisdata());
				s.setAttitudedata(z.getAttitudedata());
				s.setRadiometricmethod(z.getRadiometricmethod());
				if (z.getMtfcorrection() != null
						&& !"".equals(z.getMtfcorrection()))// 是否做MTF
					s.setMtfcpromode(z.getMtfcorrection());
				if (z.getDenoise() != null && !"".equals(z.getDenoise()))// 是否去噪
					s.setDenoise(z.getDenoise());
				if (z.getRayleighcorrection() != null
						&& !"".equals(z.getRayleighcorrection()))// 是否做瑞利散射校正
					s.setRayleighcorrection(z.getRayleighcorrection());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				s.setScenecount(z.getScenecount());
				s.setSceneshift(z.getSceneshift());
				s.setOrbittype(z.getOrbittype());
				s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				s.setStripid(z.getStripid());
				s.setProductuploaddir(z.getDataarchivefile());
			} else if (o instanceof ZywxImage3)// 3级产品
			{
				ZywxImage3 z = (ZywxImage3) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_3, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_3);
				s.setProducttype(z.getProducttype());
				// s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setReceivestationid(z.getReceivestationid());
				s.setEarthmodel(z.getEarthmodel());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				// s.setScenecount(z.getScenecount());
				// s.setSceneshift(z.getSceneshift());
				// s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				 
				// s.setStripid(z.getStripid());
				s.setEarthmodel(z.getEarthmodel());// 地球模型
				s.setProductuploaddir(z.getDataarchivefile());
			} else if (o instanceof ZywxImage4)// 4级产品
			{
				ZywxImage4 z = (ZywxImage4) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_4, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_4);
				s.setProducttype(z.getProducttype());
				// s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setReceivestationid(z.getReceivestationid());
				s.setEarthmodel(z.getEarthmodel());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				// s.setScenecount(z.getScenecount());
				// s.setSceneshift(z.getSceneshift());
				// s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				 
				// s.setStripid(z.getStripid());
				s.setEarthmodel(z.getEarthmodel());// 地球模型
				s.setProductuploaddir(z.getDataarchivefile());
			}
			Date date = new Date();
			s.setCreatetime(date);
			s.setUsername(username);
			shopinfolist.add(s);
		}
		return shopinfolist;
	}

	public static Shopinfo changeShopInfoOfProduce(OrderInfoModel orderinfomodel) {
		Shopinfo s = new Shopinfo();
		/**
		 * 生产订单应用模板参数
		 */
		if (orderinfomodel != null) {
			s.setOrdermediumid(orderinfomodel.getOrdermediumid());
			s.setOperatorname(Constants.OPERATOR_NAME);
			s.setPriority(orderinfomodel.getPriority());
			s.setOrdermediumid(orderinfomodel.getOrdermediumid());
			s.setPgproductformat(orderinfomodel.getPgproductformat());
			s.setProducttype(orderinfomodel.getProducttype());
			s.setScenecount(orderinfomodel.getScenecount());
			s.setSceneshift(orderinfomodel.getSceneshift());
			s.setOrbittype(orderinfomodel.getOrbittype());
			s.setAtttype(orderinfomodel.getAtttype());
			s.setBandnumber(orderinfomodel.getBandnumber());
			s.setImagegsd(orderinfomodel.getImagegsd());
			s.setMapprojection(orderinfomodel.getMapprojection());
			s.setEarthellipsoid(orderinfomodel.getEarthellipsoid());
			s.setResamplingkernel(orderinfomodel.getResamplingkernel());
			s.setHeightmode(orderinfomodel.getHeightmode());
			s.setEphemerisdata(orderinfomodel.getEphemerisdata());
			s.setAttitudedata(orderinfomodel.getAttitudedata());
			s.setRadiometricmethod(orderinfomodel.getRadiometricmethod());
			s.setMtfcorrection(orderinfomodel.getMtfcorrection());
			s.setDenoise(orderinfomodel.getDenoise());
			s.setRayleighcorrection(orderinfomodel.getRayleighcorrection());
			s.setNote(orderinfomodel.getNote());
			s.setClearform(orderinfomodel.getClearform());
			s.setPixelspacing(orderinfomodel.getPixelspacing());
			s.setOrthographmethod(orderinfomodel.getOrthographmethod());
			s.setGeodeticmethod(orderinfomodel.getGeodeticmethod());
			s.setEquationorder(orderinfomodel.getEquationorder());
			s.setProductorientation(orderinfomodel.getProductorientation());
			s.setEarthmodel(orderinfomodel.getEarthmodel());
			s.setMtfcpromode(orderinfomodel.getMtfcpromode());
			s.setDemtype(orderinfomodel.getDemtype());
			s.setDatatype(orderinfomodel.getDatatype());
			s.setCoordtype(orderinfomodel.getCoordtype());
			s.setImagingalgor(orderinfomodel.getImagingalgor());
			s.setFdcmethod(orderinfomodel.getFdcmethod());
			s.setAzimuthlooks(orderinfomodel.getAzimuthlooks());
			s.setRangelooks(orderinfomodel.getRangelooks());
			s.setWeightrange(orderinfomodel.getWeightrange());
			s.setDespecklemethod(orderinfomodel.getDespecklemethod());
			s.setAntennapatternsource(orderinfomodel.getAntennapatternsource());
			s.setAddwindow(orderinfomodel.getAddwindow());
			s.setCorrectphase(orderinfomodel.getCorrectphase());
			s.setReconstructprocss(orderinfomodel.getReconstructprocss());
			s.setBandsordered(orderinfomodel.getBandsordered());
			s.setWeightazimuth(orderinfomodel.getWeightazimuth());
			s.setFdrmethod(orderinfomodel.getFdrmethod());
			s.setMapzonetype(orderinfomodel.getMapzonetype());
			s.setGsd(orderinfomodel.getGsd());
			s.setAutoprocessing(orderinfomodel.getAutoprocessing());
			s.setBandregister(orderinfomodel.getBandregister());
			s.setCcdbalance(orderinfomodel.getCcdbalance());
			s.setDemsource(orderinfomodel.getDemsource());
			s.setGcpsource(orderinfomodel.getGcpsource());

		}
		return s;
	}

	public static Shopinfo changeShopInfoOfproduct(OrderInfoModel orderinfomodel) {
		Shopinfo s = new Shopinfo();
		/**
		 * 生产订单应用模板参数
		 */
		if (orderinfomodel != null) {
			s.setOrdermediumid(orderinfomodel.getOrdermediumid());
			s.setOperatorname(Constants.OPERATOR_NAME);
			s.setPriority(orderinfomodel.getPriority());
			s.setOrdermediumid(orderinfomodel.getOrdermediumid());

		}
		return s;
	}

	/**
	 * 高级产品加入购物车
	 * 
	 * @param objlist
	 * @param omodelmgr
	 * @param isProduceOrder
	 * @return
	 */
	public static List<Shopinfo> getHighShopinfo(List<Object> objlist,
			OrderInfoModelManager omodelmgr, String isProduceOrder,
			String mapnumber) {
		username = SecurityUtils.getSubject().getPrincipal().toString();
		final int userdefault = 1;
		OrderInfoModel orderinfomodel = omodelmgr
				.getOrderInfoModelByDefaultAndUsername(username, userdefault);
		List<Shopinfo> shopinfolist = new ArrayList<Shopinfo>();
		for (Object o : objlist) {
			Shopinfo s = new Shopinfo();
			if (o instanceof ZywxImageHighDem)// DEM产品
			{
				ZywxImageHighDem z = (ZywxImageHighDem) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL0_SCENE, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfProduce(orderinfomodel);
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				if (isProduceOrder != null
						&& isProduceOrder.equalsIgnoreCase("YES")) {
					s.setTasktype(new BigDecimal(1));
				} else {
					s.setTasktype(new BigDecimal(2));
					s.setProductidstring(z.getSatelliteid() + "-"
							+ z.getSensorid() + "-" + z.getSceneid() + "-"
							+ z.getProductid());
				}
				s.setProductlevel(Constants.LEVEL_DEM);
				// s.setProducttype(z.getProducttype());
				s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setReceivestationid(z.getReceivestationid());
				// s.setEarthmodel(z.getEarthmodel());
				s.setPgproductformat(z.getProductformat());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setEarthellipsoid(z.getEarthellipsoid());
				s.setResamplingkernel(z.getResamplingkernel());
				s.setHeightmode(z.getHeightmode());
				s.setEphemerisdata(z.getEphemerisdata());
				s.setAttitudedata(z.getAttitudedata());
				s.setRadiometricmethod(z.getRadiometricmethod());
				if (z.getMtfcorrection() != null
						&& !"".equals(z.getMtfcorrection()))// 是否做MTF
					s.setMtfcpromode(z.getMtfcorrection());
				if (z.getDenoise() != null && !"".equals(z.getDenoise()))// 是否去噪
					s.setDenoise(z.getDenoise());
				if (z.getRayleighcorrection() != null
						&& !"".equals(z.getRayleighcorrection()))// 是否做瑞利散射校正
					s.setRayleighcorrection(z.getRayleighcorrection());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				s.setScenecount(z.getScenecount());
				s.setSceneshift(z.getSceneshift());
				s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				s.setStripid(z.getStripid());
			}

			// 普通订单，应用元数据自带数据
			if (o instanceof ZywxImageHighDom)// DOM产品
			{
				ZywxImageHighDom z = (ZywxImageHighDom) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_1, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				if (isProduceOrder != null
						&& isProduceOrder.equalsIgnoreCase("YES")) {
					s.setTasktype(new BigDecimal(1));
				} else {
					s.setTasktype(new BigDecimal(2));
					s.setProductidstring(z.getSatelliteid() + "-"
							+ z.getSensorid() + "-" + z.getSceneid() + "-"
							+ z.getProductid());
				}
				s.setProductlevel(Constants.LEVEL_DOM);
				// s.setProducttype(z.getProducttype());
				s.setSceneid(z.getSceneid());
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setReceivestationid(z.getReceivestationid());
				// s.setEarthmodel(z.getEarthmodel());
				s.setPgproductformat(z.getProductformat());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setEarthellipsoid(z.getEarthellipsoid());
				s.setResamplingkernel(z.getResamplingkernel());
				s.setHeightmode(z.getHeightmode());
				s.setEphemerisdata(z.getEphemerisdata());
				s.setAttitudedata(z.getAttitudedata());
				s.setRadiometricmethod(z.getRadiometricmethod());
				if (z.getMtfcorrection() != null
						&& !"".equals(z.getMtfcorrection()))// 是否做MTF
					s.setMtfcpromode(z.getMtfcorrection());
				if (z.getDenoise() != null && !"".equals(z.getDenoise()))// 是否去噪
					s.setDenoise(z.getDenoise());
				if (z.getRayleighcorrection() != null
						&& !"".equals(z.getRayleighcorrection()))// 是否做瑞利散射校正
					s.setRayleighcorrection(z.getRayleighcorrection());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				s.setScenecount(z.getScenecount());
				s.setSceneshift(z.getSceneshift());
				s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				s.setStripid(z.getStripid());
			} else if (o instanceof ZywxImageHighEpistereo)// Epistereo产品
			{
				ZywxImageHighEpistereo z = (ZywxImageHighEpistereo) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_1A, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_EPISTEREO);
				// s.setProducttype(z.getProducttype());
				s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setSensorid(z.getSensorid());
				s.setReceivestationid(z.getReceivestationid());
				// s.setEarthmodel(z.getEarthmodel());
				s.setPgproductformat(z.getProductformat());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setEarthellipsoid(z.getEarthellipsoid());
				s.setResamplingkernel(z.getResamplingkernel());
				s.setHeightmode(z.getHeightmode());
				s.setEphemerisdata(z.getEphemerisdata());
				s.setAttitudedata(z.getAttitudedata());
				s.setRadiometricmethod(z.getRadiometricmethod());
				if (z.getMtfcorrection() != null
						&& !"".equals(z.getMtfcorrection()))// 是否做MTF
					s.setMtfcpromode(z.getMtfcorrection());
				if (z.getDenoise() != null && !"".equals(z.getDenoise()))// 是否去噪
					s.setDenoise(z.getDenoise());
				if (z.getRayleighcorrection() != null
						&& !"".equals(z.getRayleighcorrection()))// 是否做瑞利散射校正
					s.setRayleighcorrection(z.getRayleighcorrection());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				s.setScenecount(z.getScenecount());
				s.setSceneshift(z.getSceneshift());
				s.setOrbittype(z.getOrbittype());
				s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				s.setStripid(z.getStripid());
				// s.setEarthmodel(z.getEarthmodel());//地球模型
			} else if (o instanceof ZywxImageHighRect)// RECT级产品
			{
				ZywxImageHighRect z = (ZywxImageHighRect) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_1B, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_RECT);
				// s.setProducttype(z.getProducttype());
				s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setProductid(new BigDecimal(z.getProductid()));
				s.setSensorid(z.getSensorid());
				s.setReceivestationid(z.getReceivestationid());
				// s.setEarthmodel(z.getEarthmodel());
				s.setPgproductformat(z.getProductformat());
				s.setImagegsd(z.getImagegsd());
				s.setBandnumber(z.getBandnumber());// 产品波段数
				s.setEarthellipsoid(z.getEarthellipsoid());
				s.setResamplingkernel(z.getResamplingkernel());
				s.setHeightmode(z.getHeightmode());
				s.setEphemerisdata(z.getEphemerisdata());
				s.setAttitudedata(z.getAttitudedata());
				s.setRadiometricmethod(z.getRadiometricmethod());
				if (z.getMtfcorrection() != null
						&& !"".equals(z.getMtfcorrection()))// 是否做MTF
					s.setMtfcpromode(z.getMtfcorrection());
				if (z.getDenoise() != null && !"".equals(z.getDenoise()))// 是否去噪
					s.setDenoise(z.getDenoise());
				if (z.getRayleighcorrection() != null
						&& !"".equals(z.getRayleighcorrection()))// 是否做瑞利散射校正
					s.setRayleighcorrection(z.getRayleighcorrection());
				s.setUpperleftlat(z.getTopleftlatitude());
				s.setUpperleftlong(z.getTopleftlongitude());
				s.setUpperrightlat(z.getToprightlatitude());
				s.setUpperrightlong(z.getToprightlongitude());
				s.setLowerleftlat(z.getBottomleftlatitude());
				s.setLowerleftlong(z.getBottomleftlongitude());
				s.setLowerrightlat(z.getBottomrightlatitude());
				s.setLowerrightlong(z.getBottomrightlongitude());
				s.setScenecount(z.getScenecount());
				s.setSceneshift(z.getSceneshift());
				s.setOrbittype(z.getOrbittype());
				s.setAtttype(z.getAtttype());
				s.setMapprojection(z.getMapprojection());
				s.setStripid(z.getStripid());
			} else if (o instanceof ZywxImageHighSdem)// SDEM级产品
			{
				ZywxImageHighSdem z = (ZywxImageHighSdem) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_1C, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_SDEM);
				s.setProducttype(z.getProducttype());
				// s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setProductid(z.getProductid());
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setReceivestationid(z.getReceivestationid());
				// s.setEarthmodel(z.getEarthmodel());
				// s.setPgproductformat(z.getProductformat());
				// s.setImagegsd(z.getImagegsd());
				// s.setBandnumber(z.getBandnumber());//产品波段数
				// s.setEarthellipsoid(z.getEarthellipsoid());
				// s.setResamplingkernel(z.getResamplingkernel());
				// s.setHeightmode(z.getHeightmode());
				// s.setEphemerisdata(z.getEphemerisdata());
				// s.setAttitudedata(z.getAttitudedata());
				// s.setRadiometricmethod(z.getRadiometricmethod());
				// if(z.getMtfcorrection()!=null&&!"".equals(z.getMtfcorrection()))//是否做MTF
				// s.setMtfcpromode(z.getMtfcorrection());
				// if(z.getDenoise()!=null && !"".equals(z.getDenoise()))//是否去噪
				// s.setDenoise(z.getDenoise());
				// if(z.getRayleighcorrection()!=null &&
				// !"".equals(z.getRayleighcorrection()))//是否做瑞利散射校正
				// s.setRayleighcorrection(z.getRayleighcorrection());
				// s.setUpperleftlat(z.getTopleftlatitude());
				// s.setUpperleftlong(z.getTopleftlongitude());
				// s.setUpperrightlat(z.getToprightlatitude());
				// s.setUpperrightlong(z.getToprightlongitude());
				// s.setLowerleftlat(z.getBottomleftlatitude());
				// s.setLowerleftlong(z.getBottomleftlongitude());
				// s.setLowerrightlat(z.getBottomrightlatitude());
				// s.setLowerrightlong(z.getBottomrightlongitude());
				// s.setScenecount(z.getScenecount());
				// s.setSceneshift(z.getSceneshift());
				// s.setOrbittype(z.getOrbittype());
				// s.setAtttype(z.getAtttype());
				// s.setMapprojection(z.getMapprojection());
				// s.setStripid(z.getStripid());
			} else if (o instanceof ZywxImageHighSdom)// SDOM产品
			{
				ZywxImageHighSdom z = (ZywxImageHighSdom) o;
				if (orderinfomodel == null)
					orderinfomodel = omodelmgr.getSystemOrderInfoModel(
							Constants.LEVEL_2, z.getSatelliteid(), z
									.getSensorid());
				s = changeShopInfoOfproduct(orderinfomodel);
				s.setProductlevel(Constants.LEVEL_SDOM);
				s.setProducttype(z.getProducttype());
				// s.setSceneid(z.getSceneid());
				s.setTasktype(new BigDecimal(2));
				s.setSatelliteid(z.getSatelliteid());
				s.setSensorid(z.getSensorid());
				s.setReceivestationid(z.getReceivestationid());
				// s.setEarthmodel(z.getEarthmodel());
				// s.setPgproductformat(z.getProductformat());
				s.setProductid(z.getProductid());
				// s.setImagegsd(z.getImagegsd());
				// s.setBandnumber(z.getBandnumber());//产品波段数
				// s.setEarthellipsoid(z.getEarthellipsoid());
				// s.setResamplingkernel(z.getResamplingkernel());
				// s.setHeightmode(z.getHeightmode());
				// s.setEphemerisdata(z.getEphemerisdata());
				// s.setAttitudedata(z.getAttitudedata());
				// s.setRadiometricmethod(z.getRadiometricmethod());
				// if(z.getMtfcorrection()!=null&&!"".equals(z.getMtfcorrection()))//是否做MTF
				// s.setMtfcpromode(z.getMtfcorrection());
				// if(z.getDenoise()!=null && !"".equals(z.getDenoise()))//是否去噪
				// s.setDenoise(z.getDenoise());
				// if(z.getRayleighcorrection()!=null &&
				// !"".equals(z.getRayleighcorrection()))//是否做瑞利散射校正
				// s.setRayleighcorrection(z.getRayleighcorrection());
				// s.setUpperleftlat(z.getTopleftlatitude());
				// s.setUpperleftlong(z.getTopleftlongitude());
				// s.setUpperrightlat(z.getToprightlatitude());
				// s.setUpperrightlong(z.getToprightlongitude());
				// s.setLowerleftlat(z.getBottomleftlatitude());
				// s.setLowerleftlong(z.getBottomleftlongitude());
				// s.setLowerrightlat(z.getBottomrightlatitude());
				// s.setLowerrightlong(z.getBottomrightlongitude());
				// s.setScenecount(z.getScenecount());
				// s.setSceneshift(z.getSceneshift());
				// s.setOrbittype(z.getOrbittype());
				// s.setAtttype(z.getAtttype());
				// s.setMapprojection(z.getMapprojection());
				// s.setStripid(z.getStripid());
			}
			Date date = new Date();
			s.setCreatetime(date);
			s.setUsername(username);
			s.setMapsheetname(mapnumber);
			shopinfolist.add(s);
		}
		return shopinfolist;
	}
}
